package com.zcoj.controller.User.training;

import com.zcoj.core.model.ApiResponse;
import com.zcoj.pojo.Dto.TrainingCategory;
import com.zcoj.service.TrainingCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 接口
 * @author 剩xia的盛夏
 * @date 2023/02/24 16:16
 */
@RestController
@RequestMapping("/trainingCategory")
@Api(tags = "接口")
public class TrainingCategoryController{

    @Autowired
    private TrainingCategoryService trainingCategoryService;


    @PostMapping("/findList")
    @ApiOperation("条件查询")
    public ApiResponse findList (@RequestBody TrainingCategory trainingCategory) {
        return ApiResponse.success(trainingCategoryService.findList(trainingCategory));
    }
    /**
     * 通过ID查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @GetMapping("/{id}")
    @ApiOperation("根据ID查询")
    public ApiResponse finById(@PathVariable Integer id) {
        return ApiResponse.success(trainingCategoryService.findById(id));
    }
}
